﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using VCodeEditor.CompletionForms;
using VCodeEditor.Implement;
using VCodeEditor.PromptForms;

namespace VCodeEditor.Test
{
    public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			this.Tedit.HLStrategy =new VCodeEditor.Styles.CSharpStyle( Styles.StyleType.Default);
			//VCodeEditor.StyleManager.DefaultStyleStrategy;
			this.Tedit.InitStyle();
		}

		private void 弹出补全ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			List<DefaultCompletionData> cs = new List<DefaultCompletionData>();
			cs.Add(new CompletionForms.DefaultCompletionData("x1", "说明信息", 0));
			cs.Add(new CompletionForms.DefaultCompletionData("x2", "er", 1));
			cs.Add(new CompletionForms.DefaultCompletionData("xrty", "we", 0));
			cs.Add(new CompletionForms.DefaultCompletionData("中文提示", "we", 1));
			cs.Add(new CompletionForms.DefaultCompletionData("x中文", "we", 1));
			CompletionDataProvider dataProvider = new Gui.CompletionWindow.CompletionDataProvider(cs.ToArray());
			
			dataProvider.ImageList.Images.Add(Image.FromFile(@"F:\Working\DcvStudio IDE\Solution\Libraries\VCodeEditor\MeltuiEditor.png"));
			dataProvider.ImageList.Images.Add(Image.FromFile(@"F:\Working\DcvStudio IDE\IDE X64\IDE\assets\CodeInsiders\Class.png"));

            CodeCompletionWindow.ShowCompletionWindow(this, this.Tedit, "file.1x", dataProvider, 'x');
			
		}
		private void 弹出提示ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			PromptForm insightWindow = new Gui.InsightWindow.InsightWindow(this, this.Tedit, "file");
			insightWindow.AddInsightDataProvider(new idp());
			insightWindow.Show();
		}

		class idp : PromptItem
        {
			public int InsightDataCount { get; } = 1;
			public int DefaultIndex { get; } = 0;

			public bool CaretOffsetChanged()
			{

				return false;
			}

			public bool CharTyped()
			{
				return false;
			}

			public string GetInsightData(int number)
			{

				return "展示数据";
			}

			public void SetupDataProvider(string fileName, TextArea textArea)
			{
				
			}
		} 

	}
}
